package com.sinog.alarm.schedule;

import com.sinog.alarm.model.LocalCode;
import com.sinog.alarm.service.impl.InsertResonImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @desc TaskUtils
 * @author lk
 * @date -
 */
@Slf4j
@Component
public class TaskUtils {

    @Autowired
    private InsertResonImpl insertAlarm;
    @Autowired
    private LocalCode localCode;

    /**
     * 描述
     */
    @Scheduled(cron = "${corn}")
    public void doTask() {
        log.info("开启定时任务~");
        insertAlarm.deleteAlarmResons(localCode);
        log.info("删除昨天的警告日志数据");
        insertAlarm.selectAlarmResons();
        log.info("添加今天的警告日志数据");
        log.info("此时间段定时任务结束！");
    }
}